[codex] Structure missing provider command failures#3384
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved Refactors provider command error handling from string-parsing to structured, type-safe error classes. The change improves error diagnostics without altering when errors are thrown, and includes comprehensive test coverage. You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate 74c760b
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate 507eee5
Summary
Validation
vp test apps/server/src/provider/providerSnapshot.test.ts(2 tests)vp checkvp run typecheckNote
Low Risk
Localized provider probe error typing and classification; behavior for callers using
isCommandMissingCauseis tightened but still covers platform NotFound and the new tagged error.Overview
Replaces the message-only
ProviderCommandExecutionErrorwith a schema-backedProviderCommandNotFoundErrorwhen a provider CLI is missing (e.g. Windows exit 9009). The error carriesbinaryPath,exitCode, and stdout/stderr lengths only—no subprocess text on the failure object, so diagnostics stay safe for logs/UI.spawnAndCollectnow fails with this type instead of a genericspawn … ENOENTstring.isCommandMissingCauserecognizes the tagged error andPlatformErrorNotFoundspawn failures, and no longer treats arbitrary message substrings (e.g. legacyENOENTstrings) as missing-command signals.New tests cover classification and that sensitive stderr is not exposed on the error or its message.
Reviewed by Cursor Bugbot for commit 507eee5. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure provider command-not-found failures into a typed
ProviderCommandNotFoundErrorProviderCommandNotFoundErrorin providerSnapshot.ts, a schema-tagged error withbinaryPath,exitCode,stdoutLength, andstderrLengthfields and a stable message getter.isCommandMissingCauseto classify errors by normalized platform error type (PlatformErrorwith reasonNotFound) instead of parsing message strings; genericErrorinstances containingENOENTno longer match.spawnAndCollectto emitProviderCommandNotFoundError(with structured diagnostics) instead of a message-onlyProviderCommandExecutionErroron Windows command-not-found exits.Macroscope summarized 507eee5.